
#include "TcpClient.h"
#include "TcpServer.h"
#include "TcpSocket.h"

void InitClient()
{
    // send request to the server with its IP and port
    TcpSocket::Desc desc;
    desc.port = 6666;

    TcpSocket socket;
    socket.Create(desc);
}

int main()
{

    InitClient();
    TcpServer::Desc desc;
    desc.port = 6666;
    TcpServer server;
    std::cout << "ssss" << std::endl;
    bool res = server.Create(desc);
    if (!res)
    {
        std::cout << "Create failed" << std::endl;
        return 0;
    }

    printf("Create the socket ");
    // accept client's request
    struct sockaddr_in client_addr;
    while (int client_sock = server.Accept(client_addr))
    {
        printf("Get a new client");
        TcpClient client;
        client.Create(client_sock, client_addr);

        client.Close();
    }
    server.Close();
    return 0;
}